// import SpaceBot from '@/components/SpaceBot';
// import { cognitionTypes } from '@/services/ant-design-pro/brainSpace';
// import { SpaceType } from '@/types/spaceType';
import { connect } from '@umijs/max';
import React from 'react';
// import { history } from 'umi';
// import CommonList from '../spaceData/com/CommonList';
import NewSpaceBottomLeft from './com/newSpaceBottomLeft';
import NewSpaceBottomRight from './com/newSpaceBottomRight';
import NewSpaceTop from './com/newSpaceTop';
import './index.less';

// const imgs: any = {
//   speech: SPACETSPEECH,
//   format: SPACETSREFERENCE,
//   fact: SPACETRUTH,
//   collection: SPACETCOLLECTION,
//   good_sentence: SPACETSENTENCES,
//   good_article: SPACETFAVORITE,
// };

const SpaceHome: React.FC = (props: any) => {
  console.log(props);

  // const [items,setItems] = useState([
  //   {
  //     img: SPACETRUTH,
  //     title: '行政局知识空间',
  //     describe: '行政事务局写作所需要的相关事实材料',
  //     type: SpaceType.SPACETRUTH,
  //   },
  //   {
  //     img: SPACETSPEECH,
  //     title: '重要讲话空间',
  //     describe: '提供更多类似的优质文案备份',
  //     type: SpaceType.SPACETSPEECH,
  //   },
  //   {
  //     img: SPACETSREFERENCE,
  //     title: '公文模板空间',
  //     describe: '提供更多文章格式参考',
  //     type: SpaceType.SPACETSREFERENCE,
  //   },
  //   {
  //     img: SPACETFAVORITE,
  //     title: '好文收藏空间',
  //     describe: '横琴相关的事实数据备份',
  //     type: SpaceType.SPACETFAVORITE,
  //   },
  //   {
  //     img: SPACETSENTENCES,
  //     title: '好词好句空间',
  //     describe: '提供更多类似的优质文案',
  //     type: SpaceType.SPACETSENTENCES,
  //   },
  //   {
  //     img: SPACETCOLLECTION,
  //     title: '定期收集空间',
  //     describe: '根据上传内容定期的数据处理',
  //     type: SpaceType.SPACETCOLLECTION,
  //   },
  // ]);

  // const [items, setItems] = useState([]);
  // const [expendBot, setExpendBot] = useState(false);
  // const [showSearch, setShowSearch] = useState(false);
  // const [hitQuery, setHitQuery] = useState<any>(null);
  // const itemSelect = (item: any) => {
  //   history.push({
  //     pathname: `/spaceData?type=${item.type}&title=${item.title}`,
  //   });
  // };
  // const hitClick = (data: any) => {
  //   console.log('点击命中', data);
  //   setHitQuery(data);
  //   setShowSearch(true);
  // };

  // const getSpaceMeta = async () => {
  //   const res = await cognitionTypes({});
  //   if (res.code === 0) {
  //     const { cognition_types } = res.data;
  //     props.dispatch({
  //       type: 'spaceModel/updateCognitionType',
  //       payload: cognition_types,
  //     });

  //     const spaceTypes = cognition_types.map((type: any) => {
  //       return {
  //         img: imgs[type.name],
  //         title: type.frontend_mete_data.title,
  //         describe: type.frontend_mete_data.describe,
  //         type: type.name as SpaceType,
  //         count:type.frontend_mete_data.count
  //       };
  //     });

  //     // setItems(spaceTypes);
  //   }
  // };
  // useEffect(() => {
  //   getSpaceMeta();
  // }, []);

  return (
    <div className="space-home-wrap">
      <div className="newSpaceContainer">
        <NewSpaceTop></NewSpaceTop>
        <NewSpaceBottomLeft></NewSpaceBottomLeft>
        <NewSpaceBottomRight></NewSpaceBottomRight>
      </div>

      {/* <div className={`spaceBody ${expendBot ? '' : 'marginRight'}`}>
        {!showSearch && (
          <div className="space-container">
            {items.map((item: any, index: number) => {
              return (
                <div key={index} className="space-item" onClick={() => itemSelect(item)}>
                  <img src={item.img} width={58} height={58} />
                  <div className="title">{item.title}</div>
                  <div className="describe">{item.describe}</div>
                </div>
              );
            })}
          </div>
        )}
        {showSearch && (
          <CommonList query={hitQuery} close={() => setShowSearch(false)}></CommonList>
        )}
        <div className="space-bot">
          <SpaceBot router="spaceHome" setExpendBot={setExpendBot} hitClick={hitClick}></SpaceBot>
        </div>
      </div> */}
    </div>
  );
};
export default connect(({ spaceModel }) => ({ spaceModel }))(SpaceHome);
